library(tidyverse)
library(readxl)
path = "Excel/700-799/715/715 - Alphabetic Triangle.xlsx"
input = 15
test = read_excel(path, range = "B2:P16", col_names = FALSE) %>% as.matrix()
make_letter_triangle_matrix <- function(n) {
mat <- matrix(NA, n, n)
idx <- which(lower.tri(mat, diag = TRUE), arr.ind = TRUE)
mat[idx[order(idx[,1], idx[,2]), ]] <- rep(LETTERS, length.out = n * (n + 1) / 2)
mat
}
result = make_letter_triangle_matrix(input)
all.equal(result, test, check.attributes = FALSE)
# [1] TRUEExcel BI - Excel Challenge 715
excel-challenges
excel-formulas
🔰 A B C D E F G H I J

Challenge Description
🔰 A B C D E F G H I J
Solutions
- Logic: Read the workbook ranges needed for the challenge.
- Strengths: The code maps the workbook rule into a compact, reproducible pipeline.
- Areas for Improvement: The solution assumes the workbook layout and selected ranges remain stable, so any structural change in the sheet would require small adjustments.
- Gem: The elegant part is how little code is needed once the correct intermediate representation is chosen.
import numpy as np
import pandas as pd
path = "700-799/715/715 - Alphabetic Triangle.xlsx"
input_n = 15
test = pd.read_excel(path, header=None, skiprows=1, nrows=15, usecols="B:P").values
def make_letter_triangle_matrix(n):
seq = [chr(ord('A') + i % 26) for i in range(n * (n + 1) // 2)]
mat = np.full((n, n), np.nan, dtype=object)
idx = 0
for i in range(n):
mat[i, :i+1] = seq[idx:idx+i+1]
idx += i + 1
return mat
result = make_letter_triangle_matrix(input_n)
print(result.all() == test.all()) # TrueThe Python version keeps the algorithm explicit, which helps when the challenge depends on a greedy or iterative rule.
Difficulty Level
Easy / Medium
The business rule is clear, though the workbook still needs a few transformation steps to reach the expected output.